/*     */ package com.iris.egrant.web.struts2.tags;
/*     */ 
/*     */ import com.iris.egrant.app.utils.IrisStringUtils;
/*     */ import freemarker.template.Configuration;
/*     */ import freemarker.template.Template;
/*     */ import java.io.Writer;
/*     */ import java.util.HashMap;
/*     */ import java.util.Map;
/*     */ import javax.servlet.jsp.JspException;
/*     */ import javax.servlet.jsp.tagext.BodyTagSupport;
/*     */ import net.sf.json.JSONSerializer;
/*     */ import org.springframework.context.i18n.LocaleContextHolder;
/*     */ import org.springframework.web.context.WebApplicationContext;
/*     */ import org.springframework.web.context.support.WebApplicationContextUtils;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class AutoCompleteBySqlTag
/*     */   extends BodyTagSupport
/*     */ {
/*     */   private static final long serialVersionUID = 1077194066541229822L;
/*  30 */   private String locale = "";
/*     */   
/*  32 */   private String id = "";
/*     */   
/*  34 */   private String checkable = "false";
/*     */   
/*  36 */   private String cacheable = "false";
/*     */   
/*  38 */   private String sql = "";
/*     */   
/*  40 */   private String value = "";
/*     */   
/*  42 */   private String onClick = "";
/*     */   
/*  44 */   private String className = "";
/*     */   
/*  46 */   private String name = "";
/*     */   
/*  48 */   private String label = "";
/*     */   
/*  50 */   private String size = "";
/*     */   
/*  52 */   private String isAdd = "false";
/*     */   
/*  54 */   private String maxLength = "";
/*     */   
/*     */   public String getSize() {
/*  57 */     return this.size;
/*     */   }
/*     */   
/*     */   public void setSize(String size) {
/*  61 */     this.size = size;
/*     */   }
/*     */   
/*     */   public String getOnClick() {
/*  65 */     return this.onClick;
/*     */   }
/*     */   
/*     */   public void setOnClick(String onClick) {
/*  69 */     this.onClick = onClick;
/*     */   }
/*     */   
/*     */   public String getValue() {
/*  73 */     return this.value;
/*     */   }
/*     */   
/*     */   public void setValue(String value) {
/*  77 */     this.value = value;
/*     */   }
/*     */   
/*     */   public String isCheckable() {
/*  81 */     return this.checkable;
/*     */   }
/*     */   
/*     */   public void setCheckable(String checkable) {
/*  85 */     this.checkable = checkable;
/*     */   }
/*     */   
/*     */   public String getLocale() {
/*  89 */     if (IrisStringUtils.isNullOrBlank(this.locale)) {
/*  90 */       return LocaleContextHolder.getLocale().toString();
/*     */     }
/*  92 */     return this.locale;
/*     */   }
/*     */   
/*     */   public void setLocale(String locale) {
/*  96 */     this.locale = locale;
/*     */   }
/*     */ 
/*     */   
/*     */   public int doStartTag() throws JspException {
/* 101 */     WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(this.pageContext.getServletContext());
/*     */ 
/*     */ 
/*     */     
/* 105 */     Configuration cptFreemarkereConfiguration = (Configuration)context.getBean("cptFreemarkereConfiguration");
/*     */     
/*     */     try {
/* 108 */       String res = (String)this.pageContext.getAttribute("res");
/* 109 */       String ctx = (String)this.pageContext.getAttribute("ctx");
/*     */       
/* 111 */       Map<String, Object> params = new HashMap<String, Object>();
/* 112 */       params.put("sql", this.sql);
/* 113 */       params.put("cacheable", this.cacheable);
/* 114 */       params.put("locale", getLocale());
/*     */       
/* 116 */       Map<String, Object> jsParams = new HashMap<String, Object>();
/*     */       
/* 118 */       jsParams.put("onClick", this.onClick);
/* 119 */       jsParams.put("isAdd", this.isAdd);
/*     */       
/* 121 */       Map<String, Object> rootMap = new HashMap<String, Object>();
/* 122 */       rootMap.put("res", res);
/* 123 */       rootMap.put("id", this.id);
/* 124 */       rootMap.put("value", this.value);
/* 125 */       rootMap.put("name", this.name);
/* 126 */       rootMap.put("label", this.label);
/* 127 */       rootMap.put("ctx", ctx);
/* 128 */       rootMap.put("checkable", this.checkable);
/* 129 */       rootMap.put("maxLength", this.maxLength);
/*     */       
/* 131 */       rootMap.put("params", JSONSerializer.toJSON(params).toString());
/* 132 */       rootMap.put("jsParams", JSONSerializer.toJSON(jsParams).toString());
/* 133 */       rootMap.put("className", this.className);
/* 134 */       rootMap.put("size", this.size);
/*     */       
/* 136 */       Template template = cptFreemarkereConfiguration.getTemplate("autocompleteBySql.ftl", "utf-8");
/*     */ 
/*     */       
/* 139 */       template.process(rootMap, (Writer)this.pageContext.getOut());
/*     */     }
/* 141 */     catch (Exception e) {
/* 142 */       throw new JspException(e);
/*     */     } 
/*     */     
/* 145 */     return 0;
/*     */   }
/*     */ 
/*     */   
/*     */   public String getId() {
/* 150 */     return this.id;
/*     */   }
/*     */ 
/*     */   
/*     */   public void setId(String id) {
/* 155 */     this.id = id;
/*     */   }
/*     */   
/*     */   public String getCacheable() {
/* 159 */     return this.cacheable;
/*     */   }
/*     */   
/*     */   public void setCacheable(String cacheable) {
/* 163 */     this.cacheable = cacheable;
/*     */   }
/*     */   
/*     */   public String getCheckable() {
/* 167 */     return this.checkable;
/*     */   }
/*     */   
/*     */   public String getClassName() {
/* 171 */     return this.className;
/*     */   }
/*     */   
/*     */   public void setClassName(String className) {
/* 175 */     this.className = className;
/*     */   }
/*     */   
/*     */   public String getName() {
/* 179 */     return this.name;
/*     */   }
/*     */   
/*     */   public void setName(String name) {
/* 183 */     this.name = name;
/*     */   }
/*     */   
/*     */   public String getLabel() {
/* 187 */     return this.label;
/*     */   }
/*     */   
/*     */   public void setLabel(String label) {
/* 191 */     this.label = label;
/*     */   }
/*     */   
/*     */   public String getIsAdd() {
/* 195 */     return this.isAdd;
/*     */   }
/*     */   
/*     */   public void setIsAdd(String isAdd) {
/* 199 */     this.isAdd = isAdd;
/*     */   }
/*     */   
/*     */   public String getMaxLength() {
/* 203 */     return this.maxLength;
/*     */   }
/*     */   
/*     */   public void setMaxLength(String maxLength) {
/* 207 */     this.maxLength = maxLength;
/*     */   }
/*     */   
/*     */   public String getSql() {
/* 211 */     return this.sql;
/*     */   }
/*     */   
/*     */   public void setSql(String sql) {
/* 215 */     this.sql = sql;
/*     */   }
/*     */ }


/* Location:              D:\文件kjt\WEB-INF\lib\egrant-core-2.2.20240205.1659.jar!\com\iris\egrant\web\struts2\tags\AutoCompleteBySqlTag.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       1.1.3
 */